getAESEncryptedString, getAESDecryptedString
- It is utility functions for encrypting and decrypting strings using AES (Advanced Encryption Standard).
- These utilities are useful for securely handling sensitive data, such as user credentials or configuration values.
Functions
-
getAESEncryptedString(value)- Description: Encrypts a given string using AES encryption.
- Parameters:
value(string): The string to encrypt. Defaults to an empty string if not provided.
- Returns:
- An encrypted string if
valueis not empty. nullifvalueis empty.
- An encrypted string if
-
getAESDecryptedString(value)- Description: Decrypts an AES-encrypted string back to its original value.
- Parameters:
value(string): The encrypted string to decrypt. Defaults to an empty string if not provided.
- Returns:
- The decrypted string if
valueis not empty and valid. nullifvalueis empty or invalid.
- The decrypted string if
Usage Example
const { protrakComponents } = React.useContext(customWidgetContext);
const { TextBox } = protrakComponents;
const secretData = 'SensitiveInformation';
// Encrypt the data
const encryptedData = getAESEncryptedString(secretData);
console.log('Encrypted:', encryptedData);
// Decrypt the data
const decryptedData = getAESDecryptedString(encryptedData);
console.log('Decrypted:', decryptedData);